NestJS provides purpose-built decorators: @HttpCode() for custom status codes, @Header() for response headers, and @Redirect() for redirects. These keep the handler return value in NestJS's pipeline so interceptors and ClassSerializerInterceptor still work. Injecting @Res() bypasses the pipeline and should be avoided.
@HttpCode(status) overrides the default status — NestJS defaults to 200 for GET and 201 for POST.
@Header('key', 'value') sets a static response header — cannot be computed at runtime.
@Redirect(url, status) performs a redirect — return { url, statusCode } to override dynamically.
All three decorators keep the handler in NestJS's pipeline — interceptors still wrap the response.
Using @Res() instead switches to library-specific mode — interceptors and serialization stop working.